import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

/**
 * 字符串匹配
 */
public class StringMatch {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        loop:while (scanner.hasNext()) {
            String string1 = scanner.next();
            String string2 = scanner.next();
            String min = string1.length() > string2.length() ? string2 : string1;
            String max = string1.length() > string2.length() ? string1 : string2;
            for(int i=0; i<min.length(); i++) {
                if (!max.contains(String.valueOf(min.charAt(i)))) {
                    System.out.println(false);
                    continue loop;
                }
            }
            System.out.println(true);
        }
    }
}
